﻿using Se.Reflection;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Se.Data
{
    /// <summary>
    /// 存入库的DB表对应的DB对象
    /// </summary>
    public class DBTable
    {
        /// <summary>
        /// 数据库表名
        /// </summary>
        public string DBTableName { get; private set; }

        public Dictionary<string, DBColumn> Columns { get; private set; }

        /// <summary>
        /// 实例的类名（包含命名空间）
        /// </summary>
        public string ClassFullName { get; private set; }

        /// <summary>
        /// 存储的属性集合
        /// </summary>
        public Dictionary<string, IPropertyAccessor> DBPropertyAccesser;

        /// <summary>
        /// 所有的属性集合
        /// </summary>
        public Dictionary<string, IPropertyAccessor> AllPropertyAccesser;


        public IMethodInvoker PreLoadDataAccesser;
        public IMethodInvoker AfterLoadDataAccesser;
        public IMethodInvoker PreSaveDataAccesser;
        public IMethodInvoker AfterSaveDataAccesser;

        public DBTable(string classFullName, string dbTableName)
        {
            this.DBTableName = dbTableName;
            this.ClassFullName = classFullName;
            this.Columns = new Dictionary<string, DBColumn>();
        }

        /// <summary>
        /// 创建表
        /// </summary>
        /// <returns></returns>
        public bool CreateTableInDataBase()
        {
            return false;
        }
    }
}
